package com.mlx.meng.auto;

import com.mlx.meng.aop.DataPermissionColumnAOP;
import com.mlx.meng.aop.DataPermissionRowAOP;
import com.mlx.meng.author.AbstractDataPermissionColumnAuthorization;
import com.mlx.meng.author.AbstractDataPermissionRowAuthorization;
import com.mlx.meng.tool.DataPermissionProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(DataPermissionProperties.class)
public class MengAutoConfiguration {

    @ConditionalOnBean(AbstractDataPermissionColumnAuthorization.class)
    @Bean
    public DataPermissionColumnAOP dataPermissionColumnAOP(){
        return new DataPermissionColumnAOP();
    }

    @ConditionalOnBean(AbstractDataPermissionRowAuthorization.class)
    @Bean
    public DataPermissionRowAOP dataPermissionRowAOP(){
        return new DataPermissionRowAOP();
    }
}
